<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function Str(name, age) {
            this.name = name
            this.age = age
        }
        Str.prototype.sing = function () {
            console.log(this.name + '你太美');
        }
        const cxk = new Str('ik', 120)
        // const cxk1 = new Str('ik1', 220)
        // console.log(cxk)
        // console.log(cxk1)
        // cxk.sing()     //原型方法调用
        // cxk1.sing()    //原型方法调用
        // console.log(Str.prototype)
        // console.log(cxk1.sing === cxk.sing)   //true
        console.log(cxk.__proto__ === Str.prototype)   //true
        console.log(Str.prototype.constructor === Str)   //true
        console.log(cxk.constructor)   //Str 构造函数
        console.log(cxk.__proto__.__proto__ === Object.prototype)    //  true   (实例对象通过__proto__指向原型对象通过__proto__指向Object原型对象)
        console.log(Object.prototype.constructor === Object)      //  true    (Object原型对象有constructor属性指向构造函数Object)
    </script>
</body>

</html>